import request from '@/utils/request'

// 查询出库单列表
export function listInventory(query) {
  return request({
    url: '/sales/inventory/list',
    method: 'post',
    data: JSON.stringify(query)

  })
}

// 查询出库单详细
export function getInventory(outboundEntryId) {
  return request({
    url: '/sales/inventory/' + outboundEntryId,
    method: 'get'
  })
}

// 新增出库单
export function addInventory(data) {
  return request({
    url: '/sales/inventory/add',
    method: 'post',
    data: data
  })
}

// 修改出库单
export function updateInventory(data) {
  return request({
    url: '/sales/inventory/update',
    method: 'put',
    data: data
  })
}

// 删除出库单
export function delInventory(inventoryId) {
  return request({
    url: '/sales/inventory/' + inventoryId,
    method: 'delete'
  })
}

export function addInventoryApproval(data){
  const inventoryApproval =[{
    orderId : data.orderId,
    productId : data.productId,
    productName : data.productName,
    brand : data.brand,
    salesDetNum : data.salesDetNum,
    note : data.note
  }]
    
  const outsto = {
    outStoState : 0,
    saleOutinventory : inventoryApproval
  }
  return request({
    url: '/sales/inventory/addApproval',
    method: 'post',
    data: JSON.stringify(outsto)

  })
}


